<template>
  <div class="top">
    <content>
      <!-- <div>{{$route.query.id}}</div>
      <img :src="$route.query.img" alt="">-->
      <van-card
        v-for="item in data"
        :key="item.id"
        :price="item.originalPrice"
        :title="item.name"
        :thumb="item.pic"
        @click="chop(item)"
      />
    </content>
  </div>
</template>

<script>
import Vue from "vue";
import { Card } from "vant";

Vue.use(Card);
import content from "../../components/center/center";
export default {
  components: {
    content,
  },
  data() {
    return {
      data: [],
    };
  },
  mounted() {
    //   console.log($API.kanjia)
    this.$API.kanjia().then((res) => {
      // console.log(res);
      this.data = res.data.data.goodsMap;
    });
    // this.fn();
  },
  methods:{
    chop(item){
      console.log(item);
      this.$router.push({
        path:"/global",
        query:{
          id:item.id
        }
      })
    }
  }
};
</script>
<style lang="scss">
.top {
  margin-top: 10vh;
}
</style>